//创建router实例对象
//createWebHistory 创建createWebHistory 模式的路由
import {createRouter,createWebHistory} from'vue-router'
//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import ArticleCategoryVue from '@/views/article/ArticleCategory.vue'
import ArticleManageVue from '@/views/article/ArticleManage.vue'
import ArticleNewsVue from '@/views/article/ActicleNews.vue'
import ShopVue from '@/views/shop/index.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'


//定义路由关系
const routes = [
    // 登录页面路由
    {
        path: '/login', component: LoginVue 
    },
    // 应用主页面路由，使用布局组件
    {
        path: '/', // 默认路径
        // 应用的主布局组件 redirect重定向默认
        component: LayoutVue ,
        redirect:'/article/manage',
         //children子路由
        children:[
            {path:'/article/category',component:ArticleCategoryVue},
            {path:'/article/manage',component:ArticleManageVue},
            {path:'/article/news',component:ArticleNewsVue},
            {path:'/shop/index',component:ShopVue},
            {path:'/user/info',component:UserInfoVue},
            {path:'/user/avatar',component:UserAvatarVue},
            {path:'/user/resetPassword',component:UserResetPasswordVue}

        ]
        
    }
] 

//创建路由对象
const router = createRouter({
    history:createWebHistory(),
    routes :routes

})
//导出路由
export default router